home *** CD-ROM | disk | FTP | other *** search
/ MacFormat 1994 August / August CD.bin / Shareware / Education / numericalmethods Folder / chap_4 / zsin.m < prev    next >
Encoding:
Text File  |  1994-06-05  |  923 b   |  53 lines  |  [MATF/MATL]

  1. function [fun,dfun,ifun,x0,m,C,Ax] = zsin
  2. % Taylor series coefficient lists for several functions.
  3. % Pm(x) = c(1) + c(2)x + c(2)x^2 + ... + c(m+1)x^m
  4. % fun  is the function, output.
  5. % dfun is the derivative, output. 
  6. % ifun is the integral, output.
  7. % x0 is the point of expansion, output.
  8. % m  is the degree of the polynomial, output.
  9. % C  is the coefficient list, output.
  10. % Ax contains three asis vectors plotting, output.
  11. x0 = 0; 
  12. m = 25;
  13. a = 0;
  14. b = 10;
  15. ymin = -1.05;
  16. ymax = 1.05;
  17. ymin1 = -1.1;
  18. ymax1 = 1.1;
  19. ymin2 = -0.1;
  20. ymax2 = 2.1;
  21. Ax(1,:) = [a b ymin ymax];
  22. Ax(2,:) = [a b ymin1 ymax1];
  23. Ax(3,:) = [a b ymin2 ymax2];
  24. fun = 'sin(x)';
  25. dfun = 'cos(x)';
  26. ifun = '1-cos(x)';
  27. C = [1/15511210043330985984000000,
  28. 0,
  29. -1/25852016738884976640000,
  30. 0,
  31. 1/51090942171709440000,
  32. 0,
  33. -1/121645100408832000,
  34. 0,
  35. 1/355687428096000,
  36. 0,
  37. -1/1307674368000,
  38. 0,
  39. 1/6227020800,
  40. 0,
  41. -1/39916800,
  42. 0,
  43. 1/362880,
  44. 0,
  45. -1/5040,
  46. 0,
  47. 1/120,
  48. 0,
  49. -1/6,
  50. 0,
  51. 1,
  52. 0];
  53.